package com.uum.mq.listener;

import com.uum.mq.config.WebSocketConfig;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@RabbitListener(queues = "queue.article")
public class BlogListener {

    @RabbitHandler
    public void sendMail(Map<String, Object> map) {
        if (map != null) {
            Integer id = (Integer) map.get("blogId");
            String title = (String) map.get("blogTitle");
            System.out.println("id:[" + id + "],tile:[" + title + "]");
            WebSocketConfig.sendMessage(map);
        }

    }
}
